//判断手机
function ismobile(str){
	if(str.length != 11){
		return false;
	}else{
		var t=/^(13\d{9})|(15\d{9})|(17\d{9})|(14\d{9})|(18\d{9})|(0\d{10,11})$/;
		return t.test(str);
	}
}
//判断邮箱
function isemail(str){
	    var t = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.(?:com|cn)$/;
	    return t.test(str);
}
//身份证
function iscnCard(str){
	    var t = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
	    return t.test(str);
}

Date.prototype.diff = function(date){
  return (this.getTime() - date.getTime())/(24 * 60 * 60 * 1000);
}
function dates(date1,date2){
 var startArr=date1.split("-");
                 var startDateObj = new Date(Number(startArr[0]), Number(startArr[1]) - 1, Number(startArr[2]) + 1);
                var endArr=date2.split("-");
                 var endDateObj = new Date(Number(endArr[0]), Number(endArr[1]) - 1, Number(endArr[2]) + 1);
                var diff = endDateObj.diff(startDateObj);
                return diff;
}